package md.mru.core.repositories;

import md.mru.core.domains.administration.TreeFolder;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/**
 * @author sergiu.marin
 * @since 16.04.2014.
 */
public interface TreeModelFolderRepository extends JpaRepository<TreeFolder, Long> {

    @Modifying
    @Query("UPDATE TreeFolder tf SET tf.base=:active WHERE tf.id.treeNodeModel.id=:treeId AND tf.id.folder.id=:folderId")
    void updateTreeFolder(@Param("treeId") long treeId, @Param("folderId") long folderId, @Param("active") boolean active);
}
